<template>
  <div class="loading-overlay">
    <div class="loading-container">
      <div class="heartbeat-loader">
        <svg
          class="heartbeat-line"
          viewBox="0 0 200 50"
          preserveAspectRatio="xMidYMid meet"
        >
          <path
            class="heartbeat-path"
            d="M0,25 L40,25 L45,10 L55,40 L60,25 L100,25 L105,40 L115,10 L120,25 L160,25 L165,10 L175,40 L180,25 L200,25"
          />
        </svg>
      </div>
      <div class="text-content">
        <p class="sub-text">
          24年大一开学接触到到html、css。逐渐喜欢上写代码。到后来的js，在到今年寒假开始学习vue，看到别人写的个人博客，于是乎心中萌生了一个想法。那就是我一定要写一个属于我自己的个人博客。
          后来我有学习了java到springboot，慢慢的到现在的博客雏形...
        </p>
      </div>
    </div>
  </div>
</template>
  
  <script setup>
// 可以在这里添加props或逻辑控制显示/隐藏
</script>
  
<style lang="scss" scoped>
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(248, 249, 250, 0.98);
  z-index: 9998;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90%;
  max-width: 600px;
  padding: 25px;

  // 动画区域
  .heartbeat-loader {
    width: 100%;
    max-width: 450px;
    height: auto;
    aspect-ratio: 2/1;
    margin-bottom: 25px;

    .heartbeat-line {
      width: 100%;
      height: 100%;

      .heartbeat-path {
        fill: none;
        stroke: #7cc6e9;
        stroke-width: 4;
        stroke-linecap: round;
        stroke-linejoin: round;
        animation: heartbeat 5.5s ease-in-out infinite;
        transform-origin: left center;
      }
    }
  }

  // 文字内容区域
  .text-content {
    width: 100%;
    max-width: 550px;

    .sub-text {
      font-size: 13px;
      color: #adabab;
      text-align: center;
      line-height: 1.7;
      margin-bottom: 15px;
      padding: 0 10px;

      &:last-child {
        margin-bottom: 0;
      }
    }
  }
}

// 动画关键帧
@keyframes heartbeat {
  0% {
    transform: scaleX(1);
    stroke-dasharray: 0, 400;
    stroke-dashoffset: 0;
    opacity: 0.8;
  }
  35% {
    transform: scaleX(1.1);
    opacity: 1;
  }
  50% {
    stroke-dasharray: 400, 0;
    stroke-dashoffset: 0;
  }
  65% {
    transform: scaleX(1.05);
  }
  100% {
    transform: scaleX(1);
    stroke-dasharray: 0, 400;
    stroke-dashoffset: -400;
    opacity: 0.8;
  }
}

// 响应式调整
@media (max-width: 480px) {
  .loading-container {
    padding: 20px;

    .heartbeat-loader {
      margin-bottom: 20px;

      .heartbeat-path {
        stroke-width: 3.5;
      }
    }

    .text-content .sub-text {
      line-height: 1.6;
      padding: 0;
    }
  }
}

@media (max-width: 360px) {
  .loading-container {
    .heartbeat-loader .heartbeat-path {
      stroke-width: 3;
    }

    .text-content .sub-text {
      line-height: 1.5;
      font-size: clamp(13px, 4vw, 15px);
    }
  }
}
</style>